﻿
using System;
using System.Collections.Generic;
using System.Text;

namespace SerilogThreadIdEnricher
{
    using Serilog.Core;
    using Serilog.Events;
    using System.Threading;
    public class ThreadIdEnricher : ILogEventEnricher
    {
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
                "ThreadId", Thread.CurrentThread.ManagedThreadId.ToString("D4")));
        }
    }
}
